// ****************************************************************************** 
// Copyright     :  Copyright (C) 2018, Hisilicon Technologies Co. Ltd.
// File name     :  mdma_c_union_define.h
// Project line  :  K3
// Department    :  K3
// Author        :  Huawei
// Version       :  V100
// Date          :  2015/4/10
// Description   :  HiVcodecV100 VDEC
// Others        :  Generated automatically by nManager V4.2 
// History       :  Huawei 2018/04/10 10:02:39 Create file
// ******************************************************************************

#ifndef __MDMA_C_UNION_DEFINE_H__
#define __MDMA_C_UNION_DEFINE_H__

/* Define the union U_SRC_LUMA_ADDR */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    src_luma_base_addr : 32  ; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_SRC_LUMA_ADDR;

/* Define the union U_SRC_CHROMA_ADDR */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    src_chma_base_addr : 32  ; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_SRC_CHROMA_ADDR;

/* Define the union U_DST_LUMA_ADDR */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    dst_luma_base_addr : 32  ; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_DST_LUMA_ADDR;

/* Define the union U_DST_CHROMA_ADDR */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    dst_chma_base_addr : 32  ; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_DST_CHROMA_ADDR;

/* Define the union U_DATA_STRIDE_8BIT */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    img_height_in_pix : 14  ; /* [31:18] */
        unsigned int    ncmp_data_stride  : 18  ; /* [17:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_DATA_STRIDE_8BIT;

/* Define the union U_HEAD_INF_OFFSET */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    head_stride : 14  ; /* [31:18] */
        unsigned int    uvstride    : 18  ; /* [17:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_HEAD_INF_OFFSET;

/* Define the union U_PIC_IN_MB */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    rsv_0            : 7  ; /* [31:25] */
        unsigned int    img_height_in_mb : 9  ; /* [24:16] */
        unsigned int    rsv_1            : 7  ; /* [15:9] */
        unsigned int    img_width_in_mb  : 9  ; /* [8:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_PIC_IN_MB;

/* Define the union U_TOTAL_GRP */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    rsv_2               : 4  ; /* [31:28] */
        unsigned int    ddr_interleave_mode : 2  ; /* [27:26] */
        unsigned int    dst_store_mode      : 2  ; /* [25:24] */
        unsigned int    src_lode_mode       : 2  ; /* [23:22] */
        unsigned int    bitdepth            : 4  ; /* [21:18] */
        unsigned int    tile_linear_mode    : 1  ; /* [17] */
        unsigned int    frm_cmp_en          : 1  ; /* [16] */
        unsigned int    dma_cmd_num_min1    : 16  ; /* [15:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_TOTAL_GRP;

/* Define the union U_START_MB */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    rsv_3        : 7  ; /* [31:25] */
        unsigned int    in_start_mby : 9  ; /* [24:16] */
        unsigned int    rsv_4        : 7  ; /* [15:9] */
        unsigned int    in_start_mbx : 9  ; /* [8:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_START_MB;

/* Define the union U_END_MB */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    rsv_5      : 7  ; /* [31:25] */
        unsigned int    in_end_mby : 9  ; /* [24:16] */
        unsigned int    rsv_6      : 7  ; /* [15:9] */
        unsigned int    in_end_mbx : 9  ; /* [8:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_END_MB;

/* Define the union U_IN_MB */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    rsv_7  : 7  ; /* [31:25] */
        unsigned int    in_mby : 9  ; /* [24:16] */
        unsigned int    rsv_8  : 7  ; /* [15:9] */
        unsigned int    in_mbx : 9  ; /* [8:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_IN_MB;

/* Define the union U_SEND_MB */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    rsv_9    : 7  ; /* [31:25] */
        unsigned int    send_mby : 9  ; /* [24:16] */
        unsigned int    rsv_10   : 7  ; /* [15:9] */
        unsigned int    send_mbx : 9  ; /* [8:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_SEND_MB;

/* Define the union U_DMA_CMD */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    dma_cmd_cnt : 16  ; /* [31:16] */
        unsigned int    rsv_11      : 6  ; /* [15:10] */
        unsigned int    cur_emar_st : 2  ; /* [9:8] */
        unsigned int    rsv_12      : 1  ; /* [7] */
        unsigned int    cur_send_st : 3  ; /* [6:4] */
        unsigned int    cur_st_dma  : 4  ; /* [3:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_DMA_CMD;

/* Define the union U_CNT0 */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    rsv_13       : 12  ; /* [31:20] */
        unsigned int    dma_in_cnt   : 4  ; /* [19:16] */
        unsigned int    rsv_14       : 2  ; /* [15:14] */
        unsigned int    cmp_dat_cnt  : 6  ; /* [13:8] */
        unsigned int    head_inf_cnt : 8  ; /* [7:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_CNT0;

/* Define the union U_CNT1 */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    wemar_data_cnt : 6  ; /* [31:26] */
        unsigned int    sdat_cnt       : 4  ; /* [25:22] */
        unsigned int    send_inmb_cnt  : 6  ; /* [21:16] */
        unsigned int    send_part_cnt  : 16  ; /* [15:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_CNT1;

/* Define the union U_SRC_HEAD_YSTADDR */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    src_head_ystaddr : 32  ; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_SRC_HEAD_YSTADDR;

/* Define the union U_SRC_HEAD_CSTADDR */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    src_head_cstaddr : 32  ; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_SRC_HEAD_CSTADDR;

/* Define the union U_DST_HEAD_YSTADDR */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    dst_head_ystaddr : 32  ; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_DST_HEAD_YSTADDR;

/* Define the union U_DST_HEAD_CSTADDR */
typedef union
{
    /* Define the struct bits */
    struct
    {
        unsigned int    dst_head_cstaddr : 32  ; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    unsigned int    u32;

} U_DST_HEAD_CSTADDR;


//==============================================================================
/* Define the global struct */
typedef struct
{
    volatile U_SRC_LUMA_ADDR    SRC_LUMA_ADDR    ; /* 0 */
    volatile U_SRC_CHROMA_ADDR  SRC_CHROMA_ADDR  ; /* 4 */
    volatile U_DST_LUMA_ADDR    DST_LUMA_ADDR    ; /* 8 */
    volatile U_DST_CHROMA_ADDR  DST_CHROMA_ADDR  ; /* C */
    volatile U_DATA_STRIDE_8BIT DATA_STRIDE_8BIT ; /* 10 */
    volatile U_HEAD_INF_OFFSET  HEAD_INF_OFFSET  ; /* 14 */
    volatile U_PIC_IN_MB        PIC_IN_MB        ; /* 18 */
    volatile U_TOTAL_GRP        TOTAL_GRP        ; /* 1C */
    volatile U_START_MB         START_MB         ; /* 20 */
    volatile U_END_MB           END_MB           ; /* 24 */
    volatile U_IN_MB            IN_MB            ; /* 28 */
    volatile U_SEND_MB          SEND_MB          ; /* 2C */
    volatile U_DMA_CMD          DMA_CMD          ; /* 30 */
    volatile U_CNT0             CNT0             ; /* 34 */
    volatile U_CNT1             CNT1             ; /* 38 */
    volatile U_SRC_HEAD_YSTADDR SRC_HEAD_YSTADDR ; /* 3C */
    volatile U_SRC_HEAD_CSTADDR SRC_HEAD_CSTADDR ; /* 40 */
    volatile U_DST_HEAD_YSTADDR DST_HEAD_YSTADDR ; /* 44 */
    volatile U_DST_HEAD_CSTADDR DST_HEAD_CSTADDR ; /* 48 */

} S_mdma_REGS_TYPE;

/* Declare the struct pointor of the module mdma */
extern volatile S_mdma_REGS_TYPE *gopmdmaAllReg;

/* Declare the functions that set the member value */
int iSetSRC_LUMA_ADDR_src_luma_base_addr(unsigned int usrc_luma_base_addr);
int iSetSRC_CHROMA_ADDR_src_chma_base_addr(unsigned int usrc_chma_base_addr);
int iSetDST_LUMA_ADDR_dst_luma_base_addr(unsigned int udst_luma_base_addr);
int iSetDST_CHROMA_ADDR_dst_chma_base_addr(unsigned int udst_chma_base_addr);
int iSetDATA_STRIDE_8BIT_img_height_in_pix(unsigned int uimg_height_in_pix);
int iSetDATA_STRIDE_8BIT_ncmp_data_stride(unsigned int uncmp_data_stride);
int iSetHEAD_INF_OFFSET_head_stride(unsigned int uhead_stride);
int iSetHEAD_INF_OFFSET_uvstride(unsigned int uuvstride);
int iSetPIC_IN_MB_img_height_in_mb(unsigned int uimg_height_in_mb);
int iSetPIC_IN_MB_img_width_in_mb(unsigned int uimg_width_in_mb);
int iSetTOTAL_GRP_ddr_interleave_mode(unsigned int uddr_interleave_mode);
int iSetTOTAL_GRP_dst_store_mode(unsigned int udst_store_mode);
int iSetTOTAL_GRP_src_lode_mode(unsigned int usrc_lode_mode);
int iSetTOTAL_GRP_bitdepth(unsigned int ubitdepth);
int iSetTOTAL_GRP_tile_linear_mode(unsigned int utile_linear_mode);
int iSetTOTAL_GRP_frm_cmp_en(unsigned int ufrm_cmp_en);
int iSetTOTAL_GRP_dma_cmd_num_min1(unsigned int udma_cmd_num_min1);
int iSetSTART_MB_in_start_mby(unsigned int uin_start_mby);
int iSetSTART_MB_in_start_mbx(unsigned int uin_start_mbx);
int iSetEND_MB_in_end_mby(unsigned int uin_end_mby);
int iSetEND_MB_in_end_mbx(unsigned int uin_end_mbx);
int iSetIN_MB_in_mby(unsigned int uin_mby);
int iSetIN_MB_in_mbx(unsigned int uin_mbx);
int iSetSEND_MB_send_mby(unsigned int usend_mby);
int iSetSEND_MB_send_mbx(unsigned int usend_mbx);
int iSetDMA_CMD_dma_cmd_cnt(unsigned int udma_cmd_cnt);
int iSetDMA_CMD_cur_emar_st(unsigned int ucur_emar_st);
int iSetDMA_CMD_cur_send_st(unsigned int ucur_send_st);
int iSetDMA_CMD_cur_st_dma(unsigned int ucur_st_dma);
int iSetCNT0_dma_in_cnt(unsigned int udma_in_cnt);
int iSetCNT0_cmp_dat_cnt(unsigned int ucmp_dat_cnt);
int iSetCNT0_head_inf_cnt(unsigned int uhead_inf_cnt);
int iSetCNT1_wemar_data_cnt(unsigned int uwemar_data_cnt);
int iSetCNT1_sdat_cnt(unsigned int usdat_cnt);
int iSetCNT1_send_inmb_cnt(unsigned int usend_inmb_cnt);
int iSetCNT1_send_part_cnt(unsigned int usend_part_cnt);
int iSetSRC_HEAD_YSTADDR_src_head_ystaddr(unsigned int usrc_head_ystaddr);
int iSetSRC_HEAD_CSTADDR_src_head_cstaddr(unsigned int usrc_head_cstaddr);
int iSetDST_HEAD_YSTADDR_dst_head_ystaddr(unsigned int udst_head_ystaddr);
int iSetDST_HEAD_CSTADDR_dst_head_cstaddr(unsigned int udst_head_cstaddr);

#endif // __MDMA_C_UNION_DEFINE_H__
